older libcurses implementations.
Signed-off-by: John Levon <john.levon@sun.com>
int prompt_val_len = 0;
void (*prompt_complete_func)(char *);
+static WINDOW *cwin;
+
/*
* Function definitions
*/
/* Clean up any open resources */
static void cleanup(void)
{
- if(!isendwin())
+ if(cwin != NULL && !isendwin())
endwin();
if(prev_node != NULL)
xenstat_free_node(prev_node);
/* Display the given message and gracefully exit */
static void fail(const char *str)
{
- if(!isendwin())
+ if(cwin != NULL && !isendwin())
endwin();
fprintf(stderr, str);
exit(1);
if (!batch) {
/* Begin curses stuff */
- initscr();
+ cwin = initscr();
start_color();
cbreak();
noecho();